package com.wangsanfei.model;

import java.util.Date;

import com.jfinal.plugin.activerecord.Model;
import com.wangsanfei.util.UUIDUtils;

public class SysLog extends Model<SysLog>{

	private static final long serialVersionUID = -4534974131377911710L;
	public static final SysLog dao = new SysLog();
	
	public static final String SYSTEM_SETTINGS_EDIT="SYSTEM_SETTINGS_EDIT";
	public static final String USER_ADD="USER_ADD";
	public static final String USER_EDIT="USER_EDIT";
	public static final String NEWS_ADD="NEWS_ADD";
	public static final String NEWS_EDIT="NEWS_EDIT";
	public static final String SERVICE_EDIT="SERVICE_EDIT";
	public static final String MEMBER_EDIT="MEMBER_EDIT";
	public static final String ALIPAY_TRADE_FINISHED="ALIPAY_TRADE_FINISHED";//支付宝交易完成回调
	public static final String ALIPAY_TRADE_SUCCESS="ALIPAY_TRADE_SUCCESS";//支付宝交易成功回调
	
	public void add(String creator,String username,String operation,String logType,String dataId){
		SysLog sysLog=new SysLog();
		Date now=new Date();
		sysLog.set("id", UUIDUtils.getUUID());
		sysLog.set("createTime", now);
		sysLog.set("creator", creator);
		sysLog.set("username", username);
		sysLog.set("operation", operation);
		sysLog.set("logType", logType);
		sysLog.set("dataId", dataId);
		sysLog.save();
	}
	
	public void add(String operation,String logType,String dataId){
		SysLog sysLog=new SysLog();
		Date now=new Date();
		sysLog.set("id", UUIDUtils.getUUID());
		sysLog.set("createTime", now);
		sysLog.set("operation", operation);
		sysLog.set("logType", logType);
		sysLog.save();
	}
}
